package com.de.juxfux.juxfeuer;

import android.content.Intent;
import android.text.format.Time;
import android.util.Log;

import com.de.juxfux.Const;


public class JuxfeuerService extends AlarmAnmeldeService {
	public static final String TAG = JuxfeuerService.class.getSimpleName();
	
	public JuxfeuerService(String name) {
		super(name);
	}

	@Override
	protected Intent getAlarmIntent(Intent request) {
		Log.d(TAG, "getAlarmIntent(..) - Suchfilter = " + request.getExtras().getString(Const.SEARCHFILTER));
		Intent i = new Intent(this, JuxfeuerReceiver.class);
		// TODO: Text aus der Datenbank auslesen:
//		Dazu Informationen aus dem request auswerten, welche Daten aus der Datenbank gelesen werden sollen
//		request.getExtras().getString(Constants.SEARCHFILTER));
		String text = "bla bla blubb bla bla blubb bla bla blubb bla bla blubb bla bla blubb";
		i.putExtra(Const.JUXTEXT, text);
		return i;
	}

	@Override
	protected boolean isAlarmFunktionAktiv(Intent request) {
		Log.d(TAG, "isAlarmFunktionAktiv(..) - " + request.getExtras().getBoolean(Const.KEY_JUXFEUER_ACTIVE));
		return request.getExtras().getBoolean(Const.KEY_JUXFEUER_ACTIVE);
	}

	@Override
	protected Time getAlarmTermin(Intent request) {
		Log.d(TAG, "getAlarmTermin(..) - Intervall = " + request.getExtras().getInt(Const.KEY_JUXFEUER_INTERVAL));
		// TODO Auto-generated method stub
//		int interval = request.getExtras().getInt(Constants.KEY_JUXFEUER_INTERVALL);
		int interval = 2;
		Time time = new Time();
		time.setToNow();
		time.minute += interval;
		time.normalize(false);
		return time;
	}
	
	
}
